/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.epos.bean.util;

import com.openbravo.format.Formats;
import com.openbravo.bean.PaymentInfo;
import com.openbravo.bean.PaymentInfoCash;
import com.openbravo.pos.bean.PaymentInfoTicket;

/**
 *
 * @author Administrator
 */
public class PaymentInfoHelper {

     public static String printTotal(PaymentInfo p) {
        return Formats.CURRENCY.formatValue(new Double(p.getTotal()));
    }

    public static String printPaid(PaymentInfoCash p) {
        return Formats.CURRENCY.formatValue(new Double(p.getPaid()));
    }
    public static String printChange(PaymentInfoCash p) {
        return Formats.CURRENCY.formatValue(new Double(p.getPaid() - p.getTotal()));
    }

    public static String printPaid(PaymentInfoTicket p) {
        return Formats.CURRENCY.formatValue(new Double(p.getM_dTicket()));
    }

    // Especificas
    public static String printPaperTotal(PaymentInfoTicket p) {
        // En una devolucion hay que cambiar el signo al total
        return Formats.CURRENCY.formatValue(new Double(-p.getM_dTicket()));
    }

}
